package com.mjh.zhujianju.enums;

/**
 * 性别
 *@ClassName: SexEnum 
 * @Description 
 * @author wangdong
 * @date 2018年8月19日 下午12:17:53   
 * @version V1.0
 */
public enum SexEnum {
	
	male("1","男"),
	Female("2","女");

    private String code;
    private String name;

    SexEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static SexEnum[] getEnums(){
        return SexEnum.values();
    }

    public static String getName(String code){
        if(code == null){
            return null;
        }

        for (SexEnum SexEnum : SexEnum.values()){
            if(code.equals(SexEnum.getCode())){
                return SexEnum.getName();
            }
        }

        return null;
    }
}
